﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using seo.Data;

namespace seo.dbutils
{
    public class dbConnection
    {
        public static MySqlConnection getLocalDbConnection() {
            MySqlConnection conn;

            conn = new MySqlConnection(Properties.Settings.Default.localConnStr);

            return conn;
        }

        public static MySqlConnection getRemoteDbConnection(DbInfo dbInfo)
        {
            MySqlConnection conn;

            string conStr = string.Empty;

            conStr = "DataSource = " + dbInfo.ipaddress + "; port= " + dbInfo.portnumber + "; Database = " + dbInfo.databasename + "; User ID = " + dbInfo.username + "; Password = " + dbInfo.password + "; CharSet=utf8;";


            conn = new MySqlConnection(conStr);

            return conn;
        }


    }
}
